#include<stdio.h>
#include<unistd.h>
#include<string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
int main()
{
    //ssize_t read(int fd, void *buf, size_t count);
    char buffer[1024];
    FILE* fp=fopen("test.txt","rw");
    fwrite("abcde",5,1,fp);
    //从stdin读取到buffer里面
    ssize_t n=read(0,buffer,sizeof(buffer));
    //从fp读取到buffer里面
    //ssize_t n=read(3,buffer,sizeof(buffer));
    
    //在字符后加入结束符
    buffer[n]='\0';
    printf("%s\n %d\n",buffer,n);
    fclose(fp);
    return 0;
}
